<?php 

class ModuleVideoBitrateFilters extends CmsModule {
    public function __init() {
    
		//$this->title = 'Video Bitrate Filters';
		$this->id = 'video-bitrate';
		
		$modDateby = new CmsRadio();
		$modDateby->name = 'dateby';
		$modDateby->initTarget['custom_cssclass'] = 'dateby';  
		$modDateby->label = 'Show By';
		$modDateby->cols = 2;
		$modDateby->arr_options = AC::$dateby_list;
		$modDateby->bind = 'dateby';
		
		$modDatezone = new CmsDuration();
		$modDatezone->name = 'datezone';  
		$modDatezone->initTarget['custom_cssclass'] = 'datezone cms-form-item-hidden';  
		$modDatezone->nameType = 'array';
		$modDatezone->label = 'Date';
		$modDatezone->bind = 'start_end_day';
		
		/**
		$modCountry = new CmsCountrys();
		$modCountry->layout = 1;
		$modCountry->label = 'Region/Country'; 
		//$modCountry->bind = 'custom_country'; 
        */
        $modCountry = new CmsCountryList();
        $modCountry->name = 'countrys';   
        $modCountry->label = 'Region / Country';
        $modCountry->arr_options = AC::$country_stat;
        $modCountry->service = AC::$country_service;
        //$modCountry->bind = 'custom_country';
		
		$monthoptions = '';
        $mmonth = date("m");
		for($i=1;$i<13;$i++) {
            $i = ($i<10) ? '0'.$i : $i;
			$monthoptions .= "<option value='{$i}'".($i==$mmonth ? ' selected': '').">{$i}</option>";
		}

		$yearoptions = '';
        $myear = date("Y");
		for($i=2010;$i<date("Y")+10;$i++) {
			$yearoptions .= "<option value='{$i}'".($i==$myear ? ' selected': '').">{$i}</option>";
		}


		$modMonth = new CmsCustomFormItem();
		$modMonth->name = 'month';
		$modMonth->initTarget['custom_cssclass'] = 'bymonth2';  
		$modMonth->label = 'Month';
		$modMonth->custom_block = '<select name="startmonth" class="month wauto">'.$monthoptions.'</select>'.
                                  '<select name="startyear" class="year wauto">'.$yearoptions.'</select>'.
			                      ' To '.
                                  '<select name="endmonth" class="month wauto">'.$monthoptions.'</select>'.
                                  '<select name="endyear" class="year wauto">'.$yearoptions.'</select>';
		$modMonth->bind = 'bymonth2';
		
		$separator_hidden = new CmsSeparator();
		
		$fieldset1 = new CmsFieldset();
		$fieldset1->title = 'Show By';
		$fieldset1->addAll(array($modDateby, $modMonth,$modDatezone));
		
		$fieldset2 = new CmsFieldset();
		$fieldset2->title = 'Group By';
		$fieldset2->addAll(array($modCountry));
		
        $modbuttons = new CmsButton();
        $modbuttons->name = 'submit';
        $modbuttons->label = 'Submit';
        $modbuttons->type = 'button';
		
		$form = new CmsForm();
		$form->name = 'filter-form';
		$form->action='video_bitrate_result.html';
		$form->addAll(array(
			$fieldset1,$fieldset2,$modbuttons
		));
		
		$this->setBlock('main', $form);
    }
	
}
?>